/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __XOS_CORE_OS_PLATFORM_OS_H__
#define __XOS_CORE_OS_PLATFORM_OS_H__

#include "include.h"

//////////////////////////////////////////////////////////////////////////////////////////////////
// 

namespace os
{
    int platform_get_exe_full_file( char * pFile, int nLen )
    {
        int ret = 0;
        readlink( "/proc/self/exe", pFile, nLen );
        return ret;
    }

    const char * platform_platform()
    {
        const char * pRet = "unknown";
        pRet = "android";
        return pRet;
    }

    bool platform_can_hot_replace()
    {
        bool bRet = true;
        return bRet;
    }

    int platform_ensure_memory_visibility()
    {
        int ret = 0;
#ifdef __aarch64__
        asm volatile("dsb sy" ::: "memory"); // ARM数据同步屏障
#endif
        return ret;
    }

} // os

#endif // __XOS_CORE_OS_PLATFORM_OS_H__
